<?php
/**
 * Conversations - A lightweight BB for Xaraya
 *
 * @package modules
 * @copyright (C) 2003-2006 The Digital Development Foundation.
 * @license GPL {@link http://www.gnu.org/licenses/gpl.html}
 * @link http://www.xaraya.com
 *
 * @subpackage conversations
 * @link http://xaraya.com/index.php/release/760.html
 * @author John Cox
*/
/**
 * Delete a visit time
 * 
 * @package Xaraya eXtensible Management System
 * @copyright (C) 2005 by the Xaraya Development Team.
 * @license GPL {@link http://www.gnu.org/licenses/gpl.html}
 * @link http://www.xaraya.org
*/
/**
 * delete a visit time
 * this will probably end up being a scheduler function
 * @param $args['tagid'] integer
 * @param $args['uid'] integer
 * @returns bool
 * @return true on success, false on failure
 */
function conversations_userapi_deletevisits($args)
{
    extract($args);
    // Get datbase setup
    $dbconn =& xarDBGetConn();
    $xartable =& xarDBGetTables();
    $table = $xartable['cuvisit'];

    $query = "DELETE FROM $table ";
    
    if (!empty($tagid)) {
        $where[] = 'xar_tagid = ?';
        $bind[] = (int)$tagid;
    }
    
    if (!empty($uid)) {
        $where[] = 'xar_uid = ?';
        $bind[] = (int)$uid;
    }

    if (!empty($where)) {
        $query .= ' WHERE ' . implode(' AND ', $where);
    }
    $result =& $dbconn->Execute($query, $bind);
    if (!$result) return;
    return true;
}
?>